import sys,os
from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon
from core.app import MainWindow

def resource_path(relative_path: str):
    if getattr(sys, 'frozen', False):
        base_path = sys._MEIPASS
    else:
        base_path = os.path.dirname(__file__)
    return os.path.join(base_path, relative_path)


def main():
    app = QApplication(sys.argv)

    icon_path = resource_path("assets/logo.ico")
    app.setWindowIcon(QIcon(icon_path))

    qss_path = resource_path("assets/styles.qss")
    with open(qss_path, "r", encoding="utf-8") as f:
        app.setStyleSheet(f.read())
    window = MainWindow()
    window.show()

    sys.exit(app.exec())

if __name__ == "__main__":
    main()